<?php include $this->admin_tpl('meta', 'admin');?>
<title>添加会员 - YzmCMS内容管理系统</title>
</head>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)">
		<ul>
			 <li><label><span class="c-red">*</span>用户名：</label><input type="text" class="input" name="username" value="" onblur="get_nickname()"></li>
			 <li><label><span class="c-red">*</span>密码：</label><input type="text" class="input" name="password" value=""></li>
			 <li><label>昵称：</label><input type="text" class="input" name="nickname" value=""></li>
			 <li><label><span class="c-red">*</span>邮箱：</label><input type="email" class="input" name="email" value=""></li>
			 <li><label><span class="c-red">*</span>会员组：</label>
			 <span class="span_input"><select  name="groupid" style="margin-left:0px;">
			  <?php 
				foreach($member_group as $val){
					echo '<option value="'.$val['groupid'].'">'.$val['name'].'</option>';
				}
			   ?>			
			 </select> <span class="c-red">*会员组别影响到经验</span></span>
			 </li>
			 <li><label><span class="c-red">*</span>积分：</label><input type="text" class="input" name="point" value="0"></li>
			 <li><label>vip会员：</label>
			 <span class="span_input" title="vip会员可以免积分查看付费内容">是否为vip会员 <input name="vip" value="1" type="checkbox">&nbsp;
			 过期时间 <input type="text" class="input-text laydate-icon" style="width:175px;height:30px;" name="overduedate" value="" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"></span>
			 </li>
			 <li><input type="hidden" name="dosubmit" value="1">
			 <input class="dosubmit w_120 btn-primary radius" type="submit" value="提交">
			 <input class="btn w_120 btn-default radius" type="button" value="取消" onclick="yzmcms_close()">
			 </li>
		</ul>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer', 'admin');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/laydate/1.1/laydate.js"></script>
<script type="text/javascript">
	function get_nickname(){
		$username = $("input[name='username']").val();
		if($username != ''){
			$("input[name='nickname']").val($username);
		}
	}
	
	function dosub(obj){
		 if(obj.username.value==''){
			 layer.msg('用户名不能为空！');
			 return false;
		 }
		 if(obj.password.value=='' || obj.password.value.length < 6){
			 layer.msg('密码不能低于6位！');
			 return false;
		 }
		 if(obj.email.value==''){
			 layer.msg('邮箱不能为空！');
			 return false;
		 }
		 if(obj.point.value=='' || isNaN(obj.point.value)){
			 layer.msg('积分点数只能为数字类型！');
			 return false;
		 }
        $.ajax({
            type: 'POST',
            url: '<?php echo U('add');?>', 
            data: $(obj).serialize(),
		    dataType: "json", 
            success: function (msg) {
				if(msg.status == 1){
					parent.location.reload();       
			    }else{
					layer.msg(msg.message);
				}
            }
        })		 
		return false;			 
	}
</script> 

</body>
</html>